/*    */ package com.newcrm.webapi.sub;
/*    */ 
/*    */ import com.newcrm.bean.User;
/*    */ import com.newcrm.exception.NotFoundException;
/*    */ import com.newcrm.manager.LuceneManager;
/*    */ import com.newcrm.util.Util;
/*    */ import com.newcrm.webapi.AbstractAction;
/*    */ import com.newcrm.webapi.AbstractHttpServlet;
/*    */ import java.io.IOException;
/*    */ import java.io.PrintWriter;
/*    */ import javax.servlet.ServletException;
/*    */ import javax.servlet.http.HttpServletRequest;
/*    */ import javax.servlet.http.HttpServletResponse;
/*    */ import net.sf.json.JSONArray;
/*    */ 
/*    */ public class SearchCustomerName extends AbstractAction
/*    */ {
/* 27 */   private String indexPath = null;
/*    */ 
/*    */   public SearchCustomerName(AbstractHttpServlet servlet, String filePath)
/*    */   {
/* 36 */     super(servlet);
/* 37 */     this.indexPath = filePath;
/*    */   }
/*    */ 
/*    */   public void parse(HttpServletRequest request, HttpServletResponse response)
/*    */     throws IOException, ServletException, NotFoundException
/*    */   {
/* 43 */     response.setContentType("text/html;charset=utf-8");
/* 44 */     User user = super.getLoginUser(request);
/* 45 */     PrintWriter out = response.getWriter();
/*    */ 
/* 47 */     String term = Util.getURLParameter(request.getParameter("term"));
/*    */ 
/* 49 */     String permissionsId = null;
/* 50 */     if (!user.isAdmin) {
/* 51 */       permissionsId = user.userId;
/*    */     }
/*    */ 
/* 54 */     JSONArray array = JSONArray.fromObject(LuceneManager.getInstance(
/* 55 */       this.indexPath).search(term, permissionsId));
/*    */ 
/* 57 */     out.println(array);
/* 58 */     out.flush();
/* 59 */     out.close();
/*    */   }
/*    */ }

/* Location:           C:\E\referenceProject\CRM参考\qikebao\WEB-INF\lib\qikebao.jar
 * Qualified Name:     com.newcrm.webapi.sub.SearchCustomerName
 * JD-Core Version:    0.6.1
 */